package com.baidu.bos.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.baidu.bos.dao.IFunctionDao;
import com.baidu.bos.domain.Function;
import com.baidu.bos.domain.User;
import com.baidu.bos.service.IFunctionService;
import com.baidu.bos.utils.PageBean;
@Service
@Transactional
public class FunctionServiceImpl implements IFunctionService{
	@Resource
	private IFunctionDao functionDao;

	public void pageQuery(PageBean pageBean) {
		functionDao.pageQuery(pageBean);
	}

	public List<Function> findAll() {
		return functionDao.findAll();
	}

	public List<Function> findMenu(User user) {
		List<Function> list = null;
		if (user.getUsername().equals("admin")) {
			list = functionDao.findAllMenu();
		}else {
			list = functionDao.findMenu(user.getId());
		}
		return list;
	}

	public List<Function> findAdminMenu(User user) {
		List<Function> list = null;
		if (user.getUsername().equals("admin")) {
			list = functionDao.findAdminMenu();
		}
		return list;
	}
	

}
